package com.ict.web.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.api.client.util.Lists;
import com.ict.common.utils.DateUtils;
import com.ict.common.utils.uuid.IdUtils;
import com.ict.web.domain.SystemInfo;
import com.ict.web.mapper.SystemInfoMapper;
import com.ict.web.service.ISystemInfoService;
import com.ict.web.vo.SystemInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;


/**
 * 系统信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-03-07
 */
@Service
public class SystemInfoServiceImpl extends ServiceImpl<SystemInfoMapper,SystemInfo> implements ISystemInfoService
{
    @Autowired
    private SystemInfoMapper systemInfoMapper;


    @Override
    public List<SystemInfoVo> selectSystemInfoListByProgrammeIds(Long programmeId) {
        return systemInfoMapper.selectSystemInfoListByProgrammeIds(programmeId);
    }

    /**
     * 新增系统信息
     * 
     * @param addDtoS 系统信息
     * @return 结果
     */
    @Override
    public void insertSystemInfo(Long programmeId,List<SystemInfo> addDtoS)
    {
        if (!CollectionUtils.isEmpty(addDtoS)){
            List<SystemInfo> systemInfoList = Lists.newArrayList();
            for (SystemInfo info : addDtoS){
                systemInfoList.add(new SystemInfo(IdUtils.snowId(),programmeId,info.getSystemName(),
                        info.getSystemDesc(), SystemInfo.DELETE_STATUS_NORMAL,DateUtils.getNowDate(),DateUtils.getNowDate()));
            }
            this.saveBatch(systemInfoList);
        }

    }

}
